import { defineStore } from "pinia";

const useTagsViewStore = defineStore("tags-view", {
  state: () => ({
    /**
     * 需要缓存的页面名称
     */
    cachedViews: [],
    /**
     * 是否刷新页面
     */
    isRefresh: false
  }),
  actions: {
    addCachedView(view) {
      !this.cachedViews.includes(view.name) && view.meta.keepAlive && this.cachedViews.push(view.name);
    }
  }
});

export default useTagsViewStore;
